﻿/*
 * LINQ to LDAP
 * http://linqtoldap.codeplex.com/
 * 
 * Copyright Alan Hatter (C) 2010-2012
 * alan.hatter@gmail.com - http://hattercoding.blogspot.com/
 * 
 * This project is subject to licensing restrictions. Visit http://linqtoldap.codeplex.com/license for more information.
 */

using System;
using System.Collections.Generic;
using LinqToLdap.Collections;

namespace LinqToLdap.Mapping
{
    /// <summary>
    /// Interface for an object mapped to a directory object
    /// </summary>
    public interface IObjectMapping
    {
        /// <summary>
        /// Mapped class type
        /// </summary>
        Type Type { get; }

        /// <summary>
        /// 
        /// </summary>
        bool IsForAnonymousType { get; }

        /// <summary>
        /// Naming context for the mapped object
        /// </summary>
        string NamingContext { get; }

        /// <summary>
        /// Object category for the mapped object
        /// </summary>
        string ObjectCategory { get; }

        /// <summary>
        /// Object classes for the mapped object
        /// </summary>
        IEnumerable<string> ObjectClasses { get; }

        /// <summary>
        /// Dictionary for properties mapped to attribute names
        /// </summary>
        ReadOnlyDictionary<string, string> Properties { get; }

        /// <summary>
        /// All mapped properties
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPropertyMapping> GetPropertyMappings();

        /// <summary>
        /// All mapped properties except those mapped as read-only, store-generated, or distinguished name.
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPropertyMapping> GetUpdateablePropertyMappings();

        /// <summary>
        /// Gets a property mapping by property name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IPropertyMapping GetPropertyMapping(string name);

        /// <summary>
        /// Returns the distinguished name property mapping or null if there isn't one.
        /// </summary>
        ///<returns></returns>
        IPropertyMapping GetDistinguishedNameMapping();

        /// <summary>
        /// Creates an instance of the mapped class
        /// </summary>
        /// <param name="parameters">constructor parameters</param>
        /// <returns></returns>
        object Create(object[] parameters = null);
    }
}
